/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.seaworldsoft.publish.entity;

import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 *
 * @author sam
 */
@Entity
@Table(name = "sys_user")
public class User {

    @Id
    @TableGenerator(name = "user", table = "sys_generator", pkColumnName = "key_name", pkColumnValue = "User_ID", valueColumnName = "key_value", initialValue = 1, allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "user")
    private int userId;
    @Column(length = 50)
    private String userName;
    @ManyToOne
    @JoinColumn(name = "ROLEID")
    private Role role;
    @OneToOne(mappedBy = "createUser")
    private Article createArt;
    @OneToOne(mappedBy = "updateUser")
    private Article updateArt;
    @ManyToOne
    @JoinColumn(name="ORGID")
    private Organization org;
    @ManyToMany(mappedBy = "users")
    private List<Role> roles;


    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public Article getCreateArt() {
        return createArt;
    }

    public void setCreateArt(Article createArt) {
        this.createArt = createArt;
    }

    public Article getUpdateArt() {
        return updateArt;
    }

    public void setUpdateArt(Article updateArt) {
        this.updateArt = updateArt;
    }

    public Organization getOrg() {
        return org;
    }

    public void setOrg(Organization org) {
        this.org = org;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }
    
    
}
